axios.defaults.baseURL = 'http://123.57.109.30:3007';
axios.interceptors.response.use(function (response) {
    var layer = layui.layer;
    layer.msg(response.data.message);
    if (response.data.status == 1) {
        return Promise.reject(response.data.message)
    }
    return response
}), function (error) {
    return Promise.reject(error)
}
const registerApi = (data, fn) => axios({
    url: '/api/reguser',
    method: 'post',
    data
}).then(fn);
const loginApi = (data, fn) => axios({
    url: '/api/login',
    method: 'post',
    data
}).then(fn);
const cateApi = (data, fn) => axios({
    url: '/my/article/addcates',
    method: "post",
    data,
    headers: { "Authorization": sessionStorage.getItem('token') }
}).then(fn)

